import axios from "axios";
import { prefix } from "./index";
export const findById = async (addressId) =>{
    let response = await axios({
        method: "get",
        url: prefix +"/address/find/"+addressId,
        data:{addressId}
    })
    return response.data;
}
export const addAddress = async (address) =>{
    let response = await axios({
        method: "post",
        url: prefix +"/address",
        data:{address}
    })
    return response.data;
}
export const delAddress = async (addressId) =>{
    let response = await axios({
        method: "delete",
        url: prefix +"/address/"+addressId,
        data:{addressId}
    })
    return response.data;
}
export const updateAddress = async (address) =>{
    console.log(address)
    let response = await axios({
        method: "put",
        url: prefix +"/address",
        data:{address}
    })
    return response.data;
}
export const show = async (userId) =>{
    let response = await axios({
        method: "get",
        url: prefix +"/address/"+userId,
        data:{userId}
    })
    return response.data;
}
export const updateAddressIsDefault = async (addressId,userId) =>{
    let response = await axios({
        method: "put",
        url: prefix +"/address/"+addressId+"/"+userId,
        data:{addressId,userId}
    })
    return response.data;
}